home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 2
/
AACD 2.iso
/
AACD
/
Programming
/
NRCOBOL1g
/
COBFILES
/
INADS3.COB
< prev
next >
Wrap
Text File
|
1998-02-04
|
11KB
|
311 lines
IDENTIFICATION DIVISION.
PROGRAM-ID. INADS3.
*PROGRAM DISCRIPTION.
*
*program to create data for index files paper.nam and advert.typ
*
*AUTHOR. cHArRiOTt.
*INSTALLATION.
*DATE-WRITTEN. 24th AUG 89.
*DATE-COMPILLED.
*SECURITY.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. AMSTRAD 1512.
OBJECT-COMPUTER.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IN-NEWSPAPER-NAME
ASSIGN TO DISK
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS ER-PAPER-CODE
FILE STATUS IS WS-PAPER-FILE-STATUS.
SELECT IN-ADVERT-TYPE
ASSIGN TO DISK
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS ER-IN-AD-CODE
FILE STATUS IS WS-AD-TYPE-STATUS.
*
DATA DIVISION.
FILE SECTION.
FD IN-NEWSPAPER-NAME
LABEL RECORD IS STANDARD
VALUE OF FILE-ID IS "PAPER.NAM".
01 ER-NEWSPAPER-NAME.
03 ER-PAPER-CODE PIC X(3).
03 ER-PAPER-NAME PIC X(25).
*
FD IN-ADVERT-TYPE
LABEL RECORD IS STANDARD
VALUE OF FILE-ID IS "ADVERT.TYP".
01 ER-ADVERT-TYPE.
03 ER-IN-AD-CODE PIC 9(3).
03 ER-TYPE-OF-AD PIC X(20).
03 ER-PRICE-PER-LINE PIC 9V99.
*
**********************************************************
*
WORKING-STORAGE SECTION.
01 WS-NEWSPAPER-NAME.
03 WS-PAPER-CODE PIC X(3).
88 WS-TERMINATE-PAPER VALUE "999".
03 WS-PAPER-NAME PIC X(25).
*
01 WS-ADVERT-TYPE.
03 WS-IN-AD-CODE PIC 9(3).
88 WS-TEMINATE-ADVERTS VALUE 999.
03 WS-TYPE-OF-AD PIC X(20).
03 WS-PRICE-PER-LINE PIC 9V99.
*
01 WS-REAL-DATE.
03 WS-REAL-YEAR PIC XX.
03 WS-REAL-MONTH PIC XX.
03 WS-REAL-DAY PIC XX.
01 WS-TEMP-DATE.
03 WS-TEMP-DAY PIC XX.
03 FILLER PIC X VALUE "/".
03 WS-TEMP-MONTH PIC XX.
03 FILLER PIC X VALUE "/".
03 WS-TEMP-YEAR PIC XX.
*
01 WS-COUNTERS.
03 WS-PAGE-COUNTER PIC 99.
03 WS-LINE-COUNTER PIC 99.
03 ws-file-counter pic 999 value 0.
03 WS-PAPER-KEY PIC 999.
03 WS-ADVERT-KEY PIC 999.
01 WS-INVALID-KEY PIC X VALUE " ".
01 WS-END-ENTRY PIC X VALUE " ".
01 WS-STOP-RUN-FLAG PIC X VALUE " ".
01 WS-END-FILE-FLAG PIC X VALUE " ".
01 WS-ABORT-READ-FLAG PIC X VALUE " ".
01 WS-PAPER-FILE-STATUS PIC XX VALUE "00".
01 WS-AD-TYPE-STATUS PIC XX VALUE "00".
01 WS-RESPONCE PIC X.
88 WS-RESPONCE-Q VALUE "Q" "q".
88 WS-RESPONCE-A VALUE "A" "a".
88 WS-RESPONCE-P VALUE "P" "p".
88 WS-RESPONCE-YN VALUE "Y" "N"
"y" "n".
88 WS-RESPONCE-Y VALUE "Y" "y".
88 WS-RESPONCE-N VALUE "N" "n".
*
**********************************************************
*
SCREEN SECTION.
01 BLANK-SCREEN.
03 BLANK SCREEN.
01 PROG-DISCRIPTION.
03 LINE 1 COLUMN 5 VALUE
"A PROGRAM TO PRODUCE DATA FOR CLASSIFIED ADVERTISING INCOME
- " REPORT".
01 DIS-PROG-TITLE.
03 LINE 3 COLUMN 1 PIC X(8) FROM WS-TEMP-DATE.
03 LINE 3 COLUMN 22 HIGHLIGHT VALUE
"DATA FOR ADVERTISING INCOME REPORT".
03 LINE 3 COLUMN 65 VALUE "PAGE ".
03 LINE 3 COLUMN 70 PIC X(8) FROM WS-PAGE-COUNTER.
01 PAPER-REC.
03 LINE 6 COLUMN 5 VALUE
"NEWSPAPER DATABASE, Please enter as directed".
03 LINE 10 COLUMN 5 VALUE "NEWSPAPER NAME : ".
03 LINE 10 COLUMN 22 PIC X(25) USING WS-PAPER-NAME.
03 LINE 12 column 5 value "NEWSPAPER CODE : ".
03 LINE 12 COLUMN 22 PIC X(3) USING WS-PAPER-CODE.
03 LINE 18 COLUMN 5 VALUE "NEWSPAPER CODE '999' TO EXIT".
01 ADVERTS-REC.
03 LINE 6 COLUMN 5 VALUE
"ADVERTS DATABASE Please enter as directed".
03 LINE 10 COLUMN 5 VALUE "ADVERT CODE (numeric) : ".
03 LINE 10 COLUMN 30 PIC 9(3) USING WS-IN-AD-CODE.
03 LINE 12 COLUMN 5 VALUE "TYPE OF ADVERT (20 MAX): ".
03 LINE 12 COLUMN 30 PIC X(20) USING WS-TYPE-OF-AD.
03 LINE 14 COLUMN 5 VALUE "COST OF ADVERT (9.99) : ".
03 LINE 14 COLUMN 30 PIC 9V99 USING WS-PRICE-PER-LINE.
03 LINE 18 COLUMN 5 VALUE "ADVERT CODE '999' TO EXIT".
01 BAD-KEY.
03 LINE 18 COLUMN 5 VALUE "BAD KEY FIELD PLEASE TRY AGAIN".
01 MENU.
03 LINE 8 COLUMN 33 UNDERLINE VALUE "MENU".
03 LINE 13 COLUMN 22 VALUE "PRESS 'A' to create ADVERT.TYP".
03 LINE 15 COLUMN 22 VALUE " 'P' to create PAPER.NAME".
03 LINE 17 COLUMN 22 VALUE " 'Q' to quit MENU ".
03 LINE 20 COLUMN 19 VALUE "NOW WHAT? ".
01 MENU-INPUT.
03 LINE 20 COLUMN 29 PIC X TO WS-RESPONCE AUTO.
01 TASK-RUNING.
03 LINE 23 COLUMN 5 HIGHLIGHT VALUE
"REPORT NOW BEING PRINTED".
01 PROG-FINISH.
03 LINE 25 COLUMN 1 BLANK LINE.
03 LINE 25 COLUMN 5 VALUE "TASK COMPLEATE".
01 ANY-KEY.
03 LINE 25 COLUMN 33 PIC X TO WS-RESPONCE AUTO.
01 RESPONCE-LINE.
03 LINE 25 COLUMN 5 VALUE
"PRINT ANY KEY TO CONTINUE > ".
*
01 ERROR-MESSAGES.
03 LINE 23 COLUMN 5 VALUE
"FILE WOULD NOT OPEN :ADS:PAP:TYP:PRT:".
03 LINE 24 COLUMN 5 VALUE
"STATUS ERROR CODES : : : : :".
03 LINE 24 COLUMN 30 HIGHLIGHT PIC XX
FROM WS-PAPER-FILE-STATUS.
03 LINE 24 COLUMN 34 HIGHLIGHT PIC XX
FROM WS-AD-TYPE-STATUS.
*
**********************************************************
*
PROCEDURE DIVISION.
*
0000-MAIN.
OPEN INPUT IN-NEWSPAPER-NAME.
OPEN INPUT IN-ADVERT-TYPE.
IF WS-PAPER-FILE-STATUS = "00" AND
WS-AD-TYPE-STATUS = "00"
PERFORM 1000-DISPLAY
UNTIL WS-STOP-RUN-FLAG = "S"
ELSE
DISPLAY ERROR-MESSAGES.
CLOSE IN-NEWSPAPER-NAME.
CLOSE IN-ADVERT-TYPE.
STOP RUN.
*
**********************************************************
*
1000-DISPLAY.
ACCEPT WS-REAL-DATE FROM DATE.
MOVE WS-REAL-DAY TO WS-TEMP-DAY.
MOVE WS-REAL-MONTH TO WS-TEMP-MONTH.
MOVE WS-REAL-YEAR TO WS-TEMP-YEAR.
MOVE 1 TO WS-PAGE-COUNTER.
MOVE SPACE TO WS-END-ENTRY.
PERFORM 1005-NEWSCREEN.
DISPLAY MENU.
ACCEPT MENU-INPUT.
IF WS-RESPONCE-Q
MOVE "S" TO WS-STOP-RUN-FLAG
DISPLAY PROG-FINISH
ELSE
IF WS-RESPONCE-A
MOVE 33 TO ER-IN-AD-CODE
START IN-ADVERT-TYPE
KEY IS > ER-IN-AD-CODE
INVALID KEY DISPLAY BAD-KEY
ACCEPT ANY-KEY
END-START
PERFORM 1100-ADVERTS-REC
UNTIL WS-END-ENTRY = "S"
ELSE
IF WS-RESPONCE-P
* MOVE 3 TO WS-PAPER-KEY
* START IN-NEWSPAPER-NAME
* KEY = WS-PAPER-KEY
* INVALID KEY DISPLAY BAD-KEY
* END-START
PERFORM 1200-PAPER-REC
UNTIL WS-END-ENTRY = "S".
*
1005-NEWSCREEN.
DISPLAY BLANK-SCREEN.
DISPLAY PROG-DISCRIPTION.
DISPLAY DIS-PROG-TITLE.
*
**********************************************************
*
1102-ADVERTS-REC.
READ IN-ADVERT-TYPE INTO WS-ADVERT-TYPE
AT END MOVE "S" TO WS-END-ENTRY.
IF NOT WS-END-ENTRY = "S"
PERFORM 1005-NEWSCREEN
DISPLAY ADVERTS-REC
DISPLAY RESPONCE-LINE
ACCEPT ANY-KEY.
*
**********************************************************
*
1100-ADVERTS-REC.
PERFORM 1005-NEWSCREEN.
PERFORM 1105-BLANK-ADVERTS.
MOVE " " TO WS-INVALID-KEY.
DISPLAY ADVERTS-REC.
* ACCEPT ADVERTS-REC.
IF NOT WS-TEMINATE-ADVERTS
* MOVE WS-IN-AD-CODE TO WS-ADVERT-KEY
READ IN-ADVERT-TYPE INTO WS-ADVERT-TYPE
AT END MOVE "E" TO WS-INVALID-KEY
END-READ
IF NOT WS-INVALID-KEY = " "
MOVE "S" TO WS-END-ENTRY
ELSE
DISPLAY ADVERTS-REC
DISPLAY RESPONCE-LINE
ACCEPT ANY-KEY
END-IF
ELSE
MOVE "S" TO WS-END-ENTRY.
*
1105-BLANK-ADVERTS.
MOVE SPACES TO WS-TYPE-OF-AD.
MOVE ZERO TO WS-IN-AD-CODE.
MOVE ZERO TO WS-PRICE-PER-LINE.
*
**********************************************************
*
1202-PAPER-REC.
READ IN-NEWSPAPER-NAME INTO WS-NEWSPAPER-NAME
AT END MOVE "S" TO WS-END-ENTRY.
IF NOT WS-END-ENTRY = "S"
PERFORM 1005-NEWSCREEN
DISPLAY PAPER-REC
DISPLAY RESPONCE-LINE
ACCEPT ANY-KEY.
*
**********************************************************
*
1200-PAPER-REC.
PERFORM 1005-NEWSCREEN.
PERFORM 1205-BLANK-PAPER.
MOVE " " TO WS-INVALID-KEY.
DISPLAY PAPER-REC.
* ACCEPT PAPER-REC.
IF NOT WS-TERMINATE-PAPER
* MOVE WS-PAPER-CODE TO WS-PAPER-KEY
READ IN-NEWSPAPER-NAME INTO WS-NEWSPAPER-NAME
AT END MOVE "E" TO WS-INVALID-KEY
END-READ
IF NOT WS-INVALID-KEY = " "
MOVE "S" TO WS-END-ENTRY
ELSE
DISPLAY PAPER-REC
DISPLAY RESPONCE-LINE
ACCEPT ANY-KEY
END-IF
ELSE
MOVE "S" TO WS-END-ENTRY.
*
1205-BLANK-PAPER.
MOVE SPACES TO WS-NEWSPAPER-NAME.
* move ws-file-counter to WS-PAPER-CODE.
*
**********************************************************